import App from './App'
import Vue from 'vue'
import store from './store/index';
import {router,RouterMount} from './router/router.js';
import routerInterceptor from "./router/interceptor.js";
import httpInterceptor from '@/request/http.interceptor.js';
import httpApi from '@/request/http.api.js';
import restUrl from "./request/rest_url.js";
import utils from "./utils/utils.js";
import uView from 'uview-ui';
import tabbar from "./components/tabbar/tabbar.vue";
import navbar from "./components/navbar/navbar.vue";
import systemInfo from "./utils/systeminfo.js";
import wxRequest from "./common/wx_request.js";
import payBar from "./components/pay-bar/payBar.vue";
import globalMethods from "@/common/global_methods.js";

const promptTools = require('./utils/prompt_tools.js');
const handleToken = require('./utils/handle_token.js');
const vuexStore = require('./store/mixin.js');

Vue.config.productionTip = false;



Vue.mixin(promptTools);
Vue.mixin(handleToken);
Vue.mixin(vuexStore);
Vue.mixin(globalMethods);

Vue.use(uView);
Vue.use(router);

Vue.prototype.$restUrl = restUrl;
Vue.prototype.$utils = utils;
Vue.prototype.$systemInfo = systemInfo;
Vue.prototype.$wx = wxRequest;
Vue.prototype.$loginStatus = new Promise((resolve, reject) => {
	Vue.prototype.$loginResolve = resolve;
})
Vue.prototype.$websocketStatus = new Promise((resolve, reject) => {
	Vue.prototype.$websocketConnect = resolve;
})


Vue.component('tabbar',tabbar);
Vue.component('common-navbar',navbar);
Vue.component('payBar',payBar);

App.mpType = 'app'
const app = new Vue({
	...App,
	store
})



Vue.use(routerInterceptor, app);
Vue.use(httpInterceptor, app);
Vue.use(httpApi, app);

// #ifdef H5
RouterMount(app, router, '#app')
// #endif

// #ifndef H5
app.$mount(); //为了兼容小程序及app端必须这样写才有效果
// #endif

export default app;
